package com.example.ymm.modules1.service.impl.hl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.ymm.base.BaseServiceImpl;
import com.example.ymm.model.TableList;
import com.example.ymm.model.YmPageDto;
import com.example.ymm.modules1.entity.hl.yw.YwDept;
import com.example.ymm.modules1.entity.hl.yw.YwDeptMainRate;
import com.example.ymm.modules1.entity.ms.DDepartment;
import com.example.ymm.modules1.mapper.hl.YwDeptMapper;
import com.example.ymm.modules1.query.hl.YwDeptQueryCriteria;
import com.example.ymm.modules1.service.hl.YwDeptService;
import com.example.ymm.modules1.service.ms.DDepartmentService;
import com.example.ymm.util.QueryHelpPlus;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

@Service
@Slf4j
@DS("slave2")
public class YwDeptServiceImpl extends BaseServiceImpl<YwDeptMapper, YwDept> implements YwDeptService {

    @Override
    public TableList<YwDept> list(YwDeptQueryCriteria criteria, YmPageDto pageDto) {
        getPage(pageDto);
        List<YwDept> arrs = queryAll(criteria);
        PageInfo<YwDept> pageInfo = new PageInfo<>(arrs);
        TableList<YwDept> tableList = new TableList(pageInfo);
        return tableList;
    }

    public List<YwDept> queryAll(YwDeptQueryCriteria criteria) {
        List<YwDept> result = baseMapper.queryList(criteria);

        return result;
    }




}
